home *** CD-ROM | disk | FTP | other *** search
/ Acorn RISC PD-CD 1 / Acorn RISC PD-CD 1.iso / utilities / _graphics / graphics / _greyedit / docs / swis < prev    next >
Encoding:
Text File  |  1991-07-14  |  9.2 KB  |  245 lines

  1. >SWIs
  2.  
  3. This document describes GreyEdit 1.10 (19 Jun 1991)
  4.  
  5. ----------------------
  6. - The GreyEdit SWI's -
  7. ----------------------
  8. The GreyEdit module contains several SWI's, which are used by the main program,
  9. !RunImage.
  10.  
  11. Because some may be useful in other programs, most of the SWI's contained in
  12. this module are discussed in detail below. They are divided into two groups.
  13.  
  14. The image processing SWI's may be useful to any kind of user.
  15.  
  16. The digitiser SWI's may be useful to users that wish to make their own
  17. digitizing applications using the Zeridajh Video Digitiser.
  18.  
  19.  
  20. - The image processing SWI's
  21.  
  22. These SWI's all process or perform computations on an entire image.
  23.  
  24. Images consist of byte-values, i.e. 0(black)-255(white), that represent the
  25. pixels' greyvalues.
  26.  
  27. All image-processing SWI's expect a pointer to an image info block in r0. This
  28. block contains information about the image to be acted upon :
  29.  
  30. Offset Name  Meaning
  31. ------ ----  -------------------------------
  32.      0 start pointer to start of image data
  33.      4 xpix  horizontal resolution in pixels
  34.      8 ypix  vertical resolution in pixels
  35.     12 xskip pixels to skip at end of rows
  36.  
  37. The xskip value enables the image to be actually stored as a sprite. For
  38. example, if start=&20000, xpix=637, ypix=512, and xskip=3, then the image has
  39. the following structure :
  40.  
  41. &20000 : <637 bytes of image data> <3 bytes alignment, ignored>, i.e. row 1
  42. &20280 :  ""                        ""                         , i.e. row 2
  43. &20500 :  ""                        ""                         , i.e. row 3
  44.  .....
  45. &6FD80 :  ""                        ""                         , i.e. row 512
  46.  
  47. Thus, dis-alignment within the sprite presents no problems, as long as start
  48. points to the first valid pixel, and xskip is set to the total row-wastage.
  49.  
  50. SWI GreyEdit_Map
  51. ----------------
  52. Maps the image's pixel values.
  53.  
  54. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  55.          - r1 points to 256-entry pixel value map
  56.  
  57. I.e. for all pixels, new_pixel_value = r1?old_pixel_value
  58.  
  59. SWI GreyEdit_Cut
  60. ----------------
  61. Cuts down an image.
  62.  
  63. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  64.          - r1 points to cut info block (start/left/top/right/bottom/xskip)
  65.  
  66. The word-values in the cut info block determine the new (smaller) size and
  67. structure of the image. The new image is a sub-image of the old image, and is
  68. defined by the coordinates of its top left corner and its bottom right corner
  69. within the old image. It is stored at the address contained in the start value
  70. of the cut info block.
  71.  
  72. The xskip given in the cut info block is the xskip value of the new image. The
  73. skipped pixels in the new image are all set to 0. The left value may range from
  74. 0 to xpix-1, the right value from left to xpix-1, the top value from 0 to
  75. ypix-1, and the bottom value from top to ypix-1.
  76.  
  77. The cut info is not checked in any way, so it is your responsibility to supply
  78. sensible values.
  79.  
  80. The x/y size of the new image will obviously be right-left-1/bottom-top-1.
  81.  
  82. SWI GreyEdit_Filter
  83. -------------------
  84. Applies a filter algorithm to an image. For details on the algorithms refer to
  85. 'Technical details' in Docs.Guide.
  86.  
  87. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  88.          - r1 indicates the filter to be applied
  89.             1 - Noise (soft)
  90.             2 - Noise (strong)
  91.             3 - Gauss
  92.             4 - Average
  93.             5 - Laplace
  94.             6 - X-gradient Sobel
  95.             7 - Y-gradient Sobel
  96.             8 - Maximum
  97.             9 - Minimum
  98.            10 - Sharpen (soft)
  99.            11 - Sharpen (strong)
  100.            12 - Lee
  101.  
  102. SWI GreyEdit_Frequency
  103. ----------------------
  104. Calculates the frequencies of greyvalues in an image.
  105.  
  106. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  107. On exit  - r0 points to frequency table (4-byte counters)
  108.  
  109. I.e. the number of occurences of greyvalue g is r0!(g<<2).
  110.  
  111. SWI GreyEdit_Equalize
  112. ---------------------
  113. Applies the histogram equalization algorithm to an image.
  114.  
  115. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  116. On exit  - r0 points to cumulative histogram table (4-byte counters)
  117.          - r1 points to equalization greyvalue map
  118.  
  119. To equalize the image, this SWI should be followed by GreyEdit_Map, using the
  120. map returned at r1. The g'th entry in the cumulative histogram table represents
  121. the added frequencies of the greyvales from 0-g, i.e. the 255th entry is always
  122. equal to the total number of pixels in the image, xpix*ypix.
  123.  
  124. SWI GreyEdit_Pattern
  125. --------------------
  126. Fills the current image with a pattern.
  127.  
  128. On entry - r0 points to image info block (start/xpix/ypix/xskip)
  129.          - r1 contains pattern code
  130.            0 - clear (i.e. black, all greyvalues set to 0)
  131.            1 - 'blinds' pattern
  132.            2 - 'blinds' pattern (rotated)
  133.  
  134.  
  135. - The digitiser SWI's
  136.  
  137. These SWI's all drive the Zeridajh Video Digitiser podule. When it is not
  138. present (see GreyEdit_CheckDigi), they should not be called.
  139.  
  140. SWI GreyEdit_CheckDigi
  141. ----------------------
  142. Checks presence of the Zeridajh Video Digitiser podule, and initialises usage
  143. of the other digitiser SWI's if it is. Thus, it should always be the first SWI
  144. called.
  145.  
  146. On entry - r0 contains podule's ID code
  147. On exit  - r0 contains podule's base address if it is present, else 0
  148.  
  149. SWI GreyEdit_Grab
  150. -----------------
  151. Digitises a video image.
  152.  
  153. On entry - r0 points to image data buffer
  154.          - r1 contains size of image data buffer
  155.          - r2 contains required horizontal resolution in pixels
  156.          - r3 contains required vertical resolution in pixels
  157.          - r4<>0 gives 'line skip' (scanlines skipped at top of video image),
  158.            else default of 20 is taken (approx. center of video image)
  159.          - r5<>0 gives lowest delay factor, else default of 200 is taken.
  160.            DO NOT CHANGE, I.E. USE 0.
  161.          - r6 contains flags
  162.               bit 0 - when set (1) prevents video DMA disable when grabbing
  163.               bit 1 - when set (1) prevents re-enable of video DMA on ok exit
  164. On exit  - r0 points to error block (V set) if error occured
  165.  
  166. This SWI digitizes a video image, storing it in the supplied image data buffer.
  167. The range of available resolutions is restricted to 5*xfac/1*yfac for x/y
  168. respectively, where xfac/yfac is a power of 2, up to 640x512. When r2/r3 lies
  169. outside this range, the value is rounded up to the nearest available value.
  170. I.e. 160x128 is a valid resolution, but 161x128 would be rounded up to 320x128.
  171.  
  172. When the image buffer is too small to contain the image, an error is returned.
  173.  
  174. The value of r4 determines the number of scanlines that are skipped at the top
  175. of the video image. When a value of 0 is given, the default of 20 is taken,
  176. which skips approximately the same number of lines at the top and bottom of the
  177. video image (i.e. the 'center' is taken).
  178.  
  179. The value of r5 should always be 0. The delay factor plays an important role in
  180. the digitizing process, so it should not be tampered with. It is only present
  181. for (future) development purposes.
  182.  
  183. Video DMA is usually disabled when grabbing, and re-enabled on exit. Both of
  184. these 'effects' can be switched off by setting the appropiate bits in r6.
  185. Setting bit 0 may cause the image to be distorted, when the processing delays
  186. introduced by video DMA prevents the software to keep its synchronization with
  187. the video image.
  188.  
  189. SWI GreyEdit_VideoDMA
  190. ---------------------
  191. Turns video DMA on/off.
  192.  
  193. On entry - r0 contains 0 to turn video DMA off, or 1 to turn it on.
  194.  
  195. SWI GreyEdit_VideoTiming
  196. ------------------------
  197. Returns a number of values representing the vsync and hsync signals present in
  198. the video image. Also returns a rough classification of the video signal based
  199. on the vsync and hsync signals.
  200.  
  201. The values are returned in a signal buffer. They are bit values (0/1), which
  202. represent the exclusive OR of (NOT Burst,Vsync) from the LM1881 on the podule.
  203. The bit-values are packed 8 at a time in bytes (bit 0 first). The entire buffer
  204. is filled. Video DMA is disabled temporarily.
  205.  
  206. On entry - r0 points to signal buffer
  207.          - r1 contains length of signal buffer in bytes
  208. On exit  - r2 gives a video signal type code
  209.            -1 = no video signal detected
  210.             0 = normal video signal
  211.             1 = MacroVision protected video tape signal
  212.  
  213. SWI GreyEdit_Sensitivity
  214. ------------------------
  215. May be used to set the podule's video signal sensitivity, when the
  216. software-controlled sensitivity extension has been added to the podule.
  217.  
  218. Ask your dealer for details.
  219.  
  220. On entry - r0 contains sensitivity value and flags
  221.               bit 0-7 : sensitivity value
  222.               bit 8 : if set (1) value is percentage (0(low)-100(high))
  223.                       if clear (0) value is 0(high)-255(low)
  224. On exit  - r0 contains -1 if the PCF8591 (i.e. the extension) is not present,
  225.               else 0
  226.  
  227. Where 'low' is lowest sensitivity ('dark' images), and 'high' highest
  228. sensitivity ('light' images).
  229.  
  230. SWI GreyEdit_Switch
  231. -------------------
  232. Selects one of four independant video inputs when the colour extension has been
  233. added to the podule.
  234.  
  235. Ask your dealer for details.
  236.  
  237. On entry - r0 contains switch code
  238.               0 - switch to b/w input (luminance or composite video)
  239.               1 - switch to Red input
  240.               2 - switch to Green input
  241.               3 - switch to Blue input
  242. On exit  - r0 contains -1 if the PCF8574 (i.e. the extension) is not present,
  243.               else 0
  244.  
  245.